package com.heima.comment.controller;

import com.heima.comment.service.CommentRepayService;
import com.heima.comment.service.CommentService;
import com.heima.comment.service.impl.CommentRepayServiceImpl;
import com.heima.model.comment.dtos.*;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/comment_repay")
public class CommentRepayController {
    @Autowired
    private CommentRepayService commentRepayService;

    /**
     * 查询评论回复点赞信息
     *
     * @param commentRepayLikeDTO
     * @return
     */
    @PostMapping("/like")
    public ResponseResult like(@RequestBody CommentRepayLikeDTO commentRepayLikeDTO) {
        return commentRepayService.saveCommentRepayLike(commentRepayLikeDTO);
    }

    /**
     * 发表评论回复
     *
     * @param commentRepaySaveDTO
     * @return
     */
    @PostMapping("/save")
    public ResponseResult save(@RequestBody CommentRepaySaveDTO commentRepaySaveDTO) {
        return commentRepayService.saveCommentRepay(commentRepaySaveDTO);
    }

    /**
     * 查询评论列表
     *
     * @param commentRepayDTO
     * @return
     */
    @PostMapping("/load")
    public ResponseResult load(@RequestBody CommentRepayDTO commentRepayDTO) {
        return commentRepayService.loadCommentRepay(commentRepayDTO);
    }
}
